# -*- coding: utf-8 -*-

import random

def create_headshot():#产生中奖号码
    numbersr = list(range(1,34))
    numbersb = list(range(1,17))
    red_num = random.sample(numbersr,6)
    red_num.sort()
    blue_num = random.choice(numbersb)
    red_num.append(blue_num)
    return red_num

def judge(num1,num2): #判断是否中奖 num1为当期开奖号码，num2为自选号码
    count = 0
    for num in num2[:-1]:
        if num in num1[:-1]:
            count +=1    #红球相同的数量
        
    if count == 6 and num2[-1] == num1[-1]:
        return 'firstshot'
    elif count == 6:
        return 'secondshot'
    elif count == 5 and num2[-1] == num1[-1]:
        return 'thirdshot'
    elif count == 5 or (count == 4 and num2[-1] == num1[-1]):
        return 'forthshot'
    elif count == 4 or (count == 3 and num2[-1] == num1[-1]):
        return 'fifthshot'
    elif num2[-1] == num1[-1]:
        return 'sixthshot'
    else:
        return 'None'
    
def main():
    count = 0
    count2 = 0
    count3 = 0
    count4 = 0
    count5 = 0
    count6 = 0

    while True:
        choose_num = create_headshot()
        headshot = create_headshot()
        if judge(headshot,choose_num) == 'firstshot':
            break
        elif judge(headshot,choose_num) == 'secondshot':
            count2 += 1
        elif judge(headshot,choose_num) == 'thirdshot':
            count3 += 1
        elif judge(headshot,choose_num) == 'forthshot':
            count4 += 1
        elif judge(headshot,choose_num) == 'fifthshot':
            count5 += 1
        elif judge(headshot,choose_num) == 'sixthshot':
            count6 += 1            
        count += 1
    
    
    print('购买彩票张数为%d,花费%d元' % (count,count*2))
    print('一等奖1次')
    print('二等奖%d次' % count2)
    print('三等奖%d次' % count3)
    print('四等奖%d次' % count4)
    print('五等奖%d次' % count5)
    print('六等奖%d次' % count6)
    bones = 5*count6 + 10 * count5 + 200* count4 + 3000 * count3 + 200000*count2+5000000
    print('累计中奖金额%d'% bones)
    print('您的彩票号码为:',end ='')
    for i in choose_num:
        print(i,end=',')
    print('中奖号码为:',end ='')
    for i in headshot:
        print(i,end=',')

if __name__ == '__main__':
    main()